package com.chixing.service.impl;


import com.chixing.controller.WebSocket;
import com.chixing.mapper.MyorderMapper;
import com.chixing.pojo.Myorder;
import com.chixing.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private MyorderMapper myorderMapper;
    @Autowired
    private WebSocket webSocket;


    @Override
    public Myorder save(Myorder myorder) {
        int rows =myorderMapper.insert(myorder);
       if (rows >0 ) {

           webSocket.sendMessage("添加订单成功");

           return myorder;
       }
       else return null;
    }





    @Override
    public Myorder getById(String orderId) {
        return  myorderMapper.selectByPrimaryKey(orderId);
    }


}
